<?php 

	class sock
	{
		var $sock;
		
		function open_socket($host,$timeout = 1)
		{
            /* ICMP ping packet with a pre-calculated checksum */
            $this->sock  = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
            socket_connect($this->sock, $host, 4001);
		}
		
		function send_data_packet($packet)
		{
            socket_write($this->sock, $packet);
            $input = socket_read($this->sock, 4001);
            sleep(5);
            return $input;
		}
		
		function read_socket()
		{
			$input = socket_read($this->sock, 4001);
			sleep(5);
			return $input;
		}
		
		function close_socket()
		{
			socket_close($this->sock);
		}
	}

?>